﻿@model Wicresoft.SelfService.DAO.ServiceDetail
<h3>
    <i class="ui-icons"></i>故障详情</h3>
<div class="box_top ui-icons">
</div>
<div class="box_bg">
    <div class="box_padding">
        <div class="border_line">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr>
                        @{ 
                            Dictionary<string, string> dic = new Dictionary<string, string>();
                            dic.Add(string.Empty, "请选择...");
                            var defaultSelectList = new SelectList(dic, "key", "value");
                        }
                        <td width="20%" class="tdName">
                            @Html.LabelFor(model => model.breakDownlvl1)<span class="fontred">*</span>
                        </td>
                        <td width="80%" class="tdData">
                            @Html.DropDownListFor(model => model.breakDownlvl1, ViewData["selectListLvl1"] as SelectList)
                            <span class="fontred">@Html.ValidationMessageFor(model => model.breakDownlvl1)</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%" class="tdName">
                            @Html.LabelFor(model => model.breakDownlvl2)
                        </td>
                        <td width="80%" class="tdData">
                            @Html.DropDownListFor(model => model.breakDownlvl2, (ViewData["selectListLvl2"] ?? defaultSelectList) as SelectList)
                            @Html.ValidationMessageFor(model => model.breakDownlvl2)
                        </td>
                    </tr>
                    <tr>
                        <td width="20%" class="tdName">
                            @Html.LabelFor(model => model.breakDownlvl3)
                        </td>
                        <td width="80%" class="tdData">
                            @Html.DropDownListFor(model => model.breakDownlvl3, (ViewData["selectListLvl3"] ?? defaultSelectList) as SelectList)
                            @Html.ValidationMessageFor(model => model.breakDownlvl3)
                        </td>
                    </tr>
                    <tr>
                        <td width="20%" class="tdName">
                            @Html.LabelFor(model => model.BDSummary)<span class="fontred">*</span>
                        </td>
                        <td width="80%" class="tdData">
                            @Html.TextBoxFor(model => model.BDSummary)
                            <span class="fontred">@Html.ValidationMessageFor(model => model.BDSummary)</span>
@*                            <input value="查询知识库" type="button" id="btnSearchKB" class="Button1 ui-icons" />*@
                        </td>
                    </tr>
                    <tr>
                        <td width="20%" class="tdName">
                            @Html.LabelFor(model => model.BDDescription)<span class="fontred">*</span>
                        </td>
                        <td width="80%" class="tdData">
                            @Html.TextAreaFor(model => model.BDDescription, new { cols = "49", rows = "4", maxlength = "199" })
                            <span class="fontred">@Html.ValidationMessageFor(model => model.BDDescription)</span>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            &nbsp;
                            @Html.HiddenFor(model => model.serviceTypeID, Model.serviceTypeID)
                        </td>
                    </tr>
                    @Html.Partial("AttachmentField", Model)
                </tbody>
            </table>
        </div>
    </div>
</div>
<div class="box_down ui-icons">
</div>
<script type="text/javascript">

    $(function () {
        $("#btnSearchKB").bind("click", function () {
            var kw = $("#BDSummary").val();
            var baseUrl = "@Html.Raw(ViewBag.SearchBaseUrl)"; //need raw html string without html-encoding
            window.open(baseUrl + kw);
        });
        $("#BDSummary").bind("keydown", function (event) {
            if (event.which == 13) {
                $("#btnSearchKB").trigger('click');
            }
        });
    });

    $(function () {
        //Select联动 breakDown_lvl1
        $("#breakDownlvl1").change("click", function () {
            $.ajax({
                url: "getlvl2",
                type: "GET",
                data: { "ID": $("select#breakDownlvl1 option:selected").val(), "categoryText": $("select#breakDownlvl1 option:selected").text(), "company": $("input#account_company").val() },
                success: function (data) {
                    $("#breakDownlvl2").empty();
                    $("#breakDownlvl3").empty();
                    $("#breakDownlvl3").append("<option value='0'>请选择...</option>");
                    $.each(data, function (i, item) {
                        $("#breakDownlvl2").append("<option value='" + item.ID + "'>" + item.LvlName + "</option>");
                    });
                }
            });
            $('#breakDownlvl2').unbind('click', defaultClickEvent);
            $('#breakDownlvl3').unbind('click', defaultClickEvent);
        });

        //Select联动 breakDown_lvl2
        $("#breakDownlvl2").change("click", function () {
            $.ajax({
                url: "getlvl3",
                type: "GET",
                data: { "ID": $("select#breakDownlvl2 option:selected").val(), "categoryText": $("select#breakDownlvl1 option:selected").text() },
                success: function (data) {
                    $("#breakDownlvl3").empty();
                    $.each(data, function (i, item) {
                        $("#breakDownlvl3").append("<option value='" + item.ID + "'>" + item.LvlName + "</option>");
                    });
                }
            });
            $('#breakDownlvl3').unbind('click', defaultClickEvent);
        });
    });
</script>
